import { configureStore } from '@reduxjs/toolkit'
import { useSelector } from 'react-redux/es/hooks/useSelector'
import { shallowEqual, useDispatch } from 'react-redux/es/exports'
import { TypedUseSelectorHook } from 'react-redux/es/types'
import recommendReducer from '../views/discover/childViews/recommend/store/recommend'

const store = configureStore({
	reducer: { recommendReducer }
})

type GetStateFnType = typeof store.getState
type IRootState = ReturnType<GetStateFnType>
type DispatchType = typeof store.dispatch

export const useAppSelector: TypedUseSelectorHook<IRootState> = useSelector
export const useAppDispatch: () => DispatchType = useDispatch
export const shallowEqualApp = shallowEqual

export default store
